#include "SPVector4.h"
#include "SPMatrix.h"
#include "SPVector3.h"

namespace SP
{
	SPVector4::SPVector4(void)
	{
	}

	SPVector4::SPVector4(float x, float y, float z, float w)
		:x(x), y(y), z(z), w(w)
	{
	}

	SPVector4::SPVector4(const SPVector3& vec, float w)
		:x(vec.x), y(vec.y), z(vec.z), w(w)
	{
	}

	SPVector4::~SPVector4(void)
	{
	}

	SPVector4 SPVector4::operator*(const SPMatrix& matrix)
	{
		SPVector4 result;
		result.x = x * matrix[0][0] + y * matrix[1][0] + z * matrix[2][0] + w * matrix[3][0];
		result.y = x * matrix[0][1] + y * matrix[1][1] + z * matrix[2][1] + w * matrix[3][1];
		result.z = x * matrix[0][2] + y * matrix[1][2] + z * matrix[2][2] + w * matrix[3][2];
		result.w = x * matrix[0][3] + y * matrix[1][3] + z * matrix[2][3] + w * matrix[3][3];
		return result;
	}
}
